package com.example.walletdemo.controller;

import com.example.walletdemo.common.utils.ResponseResult;
import com.example.walletdemo.entity.vo.TransactionVo;
import com.example.walletdemo.service.WalletRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 包
 * @Date: 2023/2/20 22:59
 * Description:
 */
@RestController
@RequestMapping("/walletrecord")
public class WalletRecordController {

    @Autowired
    private WalletRecordService walletRecordService;

    @PostMapping("/consume")
    public ResponseResult consume(@RequestBody TransactionVo transactionVo){
        System.out.println(transactionVo.getUserId());
        System.out.println(transactionVo.getWalletId());
        System.out.println(transactionVo.getRecordType());
        return walletRecordService.consume(transactionVo);
    }

    @PostMapping("/refund")
    public ResponseResult refund(@RequestBody TransactionVo transactionVo){
        return walletRecordService.refund(transactionVo);
    }

    @PostMapping("/recordDetails")
    public ResponseResult recordDetails(@RequestParam("walletId") Long walletId){
        return walletRecordService.recordDetails(walletId);
    }
}
